<template>
    <div>
         <van-field
            v-model="form.name"
            name="name"
            label="名称"
            placeholder="名称"
            :rules="[{ required: true, message: '请填写名称' }]"
          />
          <van-button @click="add" round>修改</van-button>

    </div>
</template>

<script>
    export default {
        data() {
            return {
                form:{},
                id:this.$route.query.id
                

            }
        },
        methods: {
             add(){
                this.$axios.put('/add_ncate?id='+this.id+'&name='+this.form.name)
                .then((res)=> {
                    if(res.data.code==200){
                        alert('修改成功')
                        this.form = {}
                        this.$router.push('/ncate')
                    }})

            },
        },
        
    }
</script>

<style scoped>

</style>